package com.fly.demo.job;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

import com.fly.demo.entity.Welcome;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Configuration
public class TaskJob
{
    @Autowired
    private Welcome welcome;
    
    /**
     * 不能实时刷新
     */
    @Value("${welcome.message:hello, 00fly in java!}")
    private String msg;
    
    /**
     * 测试日志打印
     */
    @Scheduled(fixedRate = 10000)
    public void run()
    {
        log.trace("★★★★★★★★ {}, {}", welcome.getMessage(), msg);
        log.debug("★★★★★★★★ {}, {}", welcome.getMessage(), msg);
        log.info("★★★★★★★★ {}, {}", welcome.getMessage(), msg);
        log.warn("★★★★★★★★ {}, {}", welcome.getMessage(), msg);
    }
}
